﻿using Android.App;
using Android.OS;
using Android.Runtime;
using AppPushDemo.Adapters;
using System.Collections.Generic;
using AndroidX.AppCompat.App;
using AndroidX.RecyclerView.Widget;

namespace AppPushDemo
{
    [Activity(Name = "priv.xp.apppushdemo.MainActivity", Label = "@string/app_name", Theme = "@style/AppTheme", MainLauncher = true)]
    public class MainActivity : AppCompatActivity
    {
        IList<string> _items = new List<string>();
        public static LogAdapter Adapter;

        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);

            Adapter = new LogAdapter(_items);
            var rvLog = FindViewById<RecyclerView>(Resource.Id.rvLog);
            var lm = new LinearLayoutManager(this);
            rvLog.SetLayoutManager(lm);
            rvLog.SetAdapter(Adapter);
            Adapter.AddData(LocalClassName);
        }
        public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults)
        {
            Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);

            base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
        }
    }
}